#ifndef _MY_CREATE_ROLE_H_
#define _MY_CREATE_ROLE_H_
#include "cocos2d.h"
#include "BGClipLayer.h"
#include "AppDelegate.h"

using namespace cocos2d;

namespace fireplane
{
	class CreateRole : public CCLayer
	{
	public:
		// Here's a difference. Method 'init' in cocos2d-x returns bool, instead of returning 'id' in cocos2d-iphone
		virtual bool init();  
		// there's no 'id' in cpp, so we recommand to return the exactly class pointer
		static cocos2d::CCScene* scene();
		// implement the "static node()" method manually
		LAYER_NODE_FUNC(CreateRole);

		static bool loadRes(void);
	private:
		void registerWithTouchDispatcher();
		void _createUI();
		void onClickPlane(CCObject* pSender);
		void onStartGame(CCObject* pSender);
		void onBackMenu(CCObject* pSender);

		void onFocusChange(int idx);
		void _createIntroduce(int idx,const char* filename);

		virtual bool ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent);
		virtual void ccTouchMoved(CCTouch *pTouch, CCEvent *pEvent);
		virtual void ccTouchEnded(CCTouch *pTouch, CCEvent *pEvent);
		void _createAttribute(int idx,const char* filename);
		
		CCMenuItemSprite* _plane_items[6];

		CCSprite* _select;
		int _selectIdx;

		CCSprite* _all_planes[6];

		BGClipLayer* _leftclip;
		CCLabelTTF* _all_planes_intro[6];
		CCPoint _all_planes_intro_startpos[6];

		CCPoint _beginPos;


		BGClipLayer* _rightclip;
		CCLabelTTF* _all_planes_attribute[6];
		CCPoint _all_planes_attribute_startpos[6];

		CCLabelTTF* _active_ttf;
		CCPoint* _active_pos;
	};
}

#endif